package com.springcloudexercise.userservice.Controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class KafkaMessageController {
    private KafkaTemplate kafkaTemplate;
    @Autowired
    KafkaMessageController(KafkaTemplate kafkaTemplate){
        this.kafkaTemplate = kafkaTemplate;
    }

    @GetMapping("/sendLogMsg/{msg}")
    public void sendLogMsg(@PathVariable String msg) {
        kafkaTemplate.send("logMsg", msg);
    }
}
